<?php
/**
 * Created by PhpStorm.
 * User: luoshuqi
 * Date: 19-2-15
 * Time: 下午3:47
 */

namespace App\Models;


use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class SysGroup extends Model
{
    use SoftDeletes;

    public function getOperationIdsAttribute()
    {
        $values = $this->attributes['operation_ids'];
        if ($values) {
            $values = explode(',', $values);
            return array_map('intval', $values);
        }
        return [];
    }

    public function setOperationIdsAttribute($value)
    {
        $value = $value ? implode(',', $value) : null;
        $this->attributes['operation_ids'] = $value;
    }
}